﻿using EntityFramework.Entity.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YouTravel.DomainModels;

namespace Repositories.Configuration
{
    public class CollectInvoiceDetailMap : EntityConfigurationBase<CollectInvoiceDetail>
    {
        public CollectInvoiceDetailMap()
        {
            this.Property(p => p.Code).HasMaxLength(50).IsRequired();
            this.Property(p => p.Money).HasPrecision(18, 2);
            this.Property(p => p.Content).HasMaxLength(500);

            this.HasRequired(p => p.CollectInvoice).WithMany(p => p.CollectInvoiceDetail).HasForeignKey(f => f.CollectInvoiceId);
            this.HasRequired(p => p.CollectInvoiceGroup).WithMany(p => p.CollectInvoiceDetail).HasForeignKey(f => f.GroupId);
        }
    }
}
